home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 May / SGI IRIX 6.5 Complementary Applications 2004 May.iso / dist / OpenOffice.idb / usr / OpenOffice / help / en / sbasic.jar / text / sbasic / common / 03020201.xml < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-24  |  3.5 KB  |  56 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>Get Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03020201"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         p.P2{
  7.                 }
  8.         span.T1{
  9.                 font-weight:bold;}
  10.         </style></head><body>
  11.   
  12.   
  13.   <help:to-be-embedded Eid="get" xmlns:help="http://openoffice.org/2000/help"><a name="get"/>
  14.   <p class="Head1"><help:link Id="66578">Get Statement [Runtime]</help:link></p>
  15.   <p class="Paragraph">Reads a record from a relative file, or a sequence of bytes from a binary file, into a variable.</p>
  16.   </help:to-be-embedded>
  17.   <p class="Paragraph">See also: <help:link Id="66627" Eid="put" xmlns:help="http://openoffice.org/2000/help">PUT</help:link> Statement</p>
  18.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  19.   <p class="Paragraph">Get [#] FileNumber As Integer, [Position], Variable <help:key-word value="Get" tag="kw66578_1" xmlns:help="http://openoffice.org/2000/help"/></p>
  20.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  21.   <p class="Paragraph">FileNumber: Any integer expression that determines the file number.</p>
  22.   <p class="Paragraph">Position: For files opened in Random mode, <span class="T1">Position</span> is the number of the record to be read.</p>
  23.   <p class="Paragraph">For files opened in Binary mode, <span class="T1">Position</span> is the byte position within the file where reading starts.</p>
  24.   <p class="Paragraph">If <span class="T1">Position</span> is omitted, the current position or the current data record of the file is used.</p>
  25.   <p class="Paragraph">Variable: Name of the variable to be read. With the exception of object variables, any variable type can be used.</p>
  26.   <p class="P2">Example:</p>
  27.   <p class="PropText">Sub ExampleRandomAccess</p>
  28.   <p class="PropText">Dim iNumber As Integer</p>
  29.   <p class="PropText">Dim sText As Variant REM Must be a variant</p>
  30.   <p class="PropText">Dim aFile As String</p>
  31.   <p class="PropText">aFile = "c:\data.txt"</p>
  32.   <p class="PropText"/>
  33.   <p class="PropText">iNumber = Freefile</p>
  34.   <p class="PropText">Open aFile For Random As #iNumber Len=32</p>
  35.   <p class="PropText">Seek #iNumber,1 <text:s text:c="2" xmlns:text="http://openoffice.org/2000/text"/>REM Position at beginning</p>
  36.   <p class="PropText">Put #iNumber,, "This is the first line of text" <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>REM Fill line with text</p>
  37.   <p class="PropText">Put #iNumber,, "This is the second line of text"</p>
  38.   <p class="PropText">Put #iNumber,, "This is the third line of text"</p>
  39.   <p class="PropText">Seek #iNumber,2</p>
  40.   <p class="PropText">Get #iNumber,,sText</p>
  41.   <p class="PropText">Print sText</p>
  42.   <p class="PropText">Close #iNumber</p>
  43.   <p class="PropText"/>
  44.   <p class="PropText">iNumber = Freefile</p>
  45.   <p class="PropText">Open aFile For Random As #iNumber Len=32</p>
  46.   <p class="PropText">Get #iNumber,2,sText</p>
  47.   <p class="PropText">Put #iNumber,,"This is a new text"</p>
  48.   <p class="PropText">Get #iNumber,1,sText</p>
  49.   <p class="PropText">Get #iNumber,2,sText</p>
  50.   <p class="PropText">Put #iNumber,20,"This is the text in record 20"</p>
  51.   <p class="PropText">Print Lof(#iNumber)</p>
  52.   <p class="PropText">Close #iNumber</p>
  53.   <p class="PropText"/>
  54.   <p class="PropText">end sub</p>
  55.   <p class="PropText"/>
  56.  </body></html>